home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 August / ENTER.ISO / files / gimp-2.0.5-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / beveled-pattern-heading.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2004-09-26  |  3.7 KB  |  108 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; Beveled pattern heading for web pages
  5. ; Copyright (C) 1997 Federico Mena Quintero
  6. ; federico@nuclecu.unam.mx
  7. ;
  8. ; This program is free software; you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 2 of the License, or
  11. ; (at your option) any later version.
  12. ;
  13. ; This program is distributed in the hope that it will be useful,
  14. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ; GNU General Public License for more details.
  17. ;
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. ; ************************************************************************
  22. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  23. ; For use with GIMP 1.1.
  24. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  25. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  26. ; ************************************************************************
  27.  
  28.  
  29. (define (script-fu-beveled-pattern-heading
  30.      text text-size font pattern transparent)
  31.   (let* ((old-bg-color (car (gimp-palette-get-background)))
  32.  
  33.      (img (car (gimp-image-new 10 10 RGB)))
  34.      (textl
  35.       (car
  36.        (gimp-text-fontname img -1 0 0 text 0 TRUE text-size PIXELS font)))
  37.  
  38.      (width (car (gimp-drawable-width textl)))
  39.      (height (car (gimp-drawable-height textl)))
  40.  
  41.      (background (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
  42.      (bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))))
  43.  
  44.     (gimp-image-undo-disable img)
  45.     (gimp-image-resize img width height 0 0)
  46.     (gimp-image-add-layer img background 1)
  47.     (gimp-image-add-layer img bumpmap 1)
  48.  
  49.     ; Create pattern layer
  50.  
  51.     (gimp-palette-set-background '(0 0 0))
  52.     (gimp-edit-fill background BACKGROUND-FILL)
  53.     (gimp-patterns-set-pattern pattern)
  54.     (gimp-edit-bucket-fill background PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  55.  
  56.     ; Create bumpmap layer
  57.  
  58.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  59.  
  60.     (gimp-palette-set-background '(127 127 127))
  61.     (gimp-selection-layer-alpha textl)
  62.     (gimp-selection-shrink img 1)
  63.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  64.  
  65.     (gimp-palette-set-background '(255 255 255))
  66.     (gimp-selection-layer-alpha textl)
  67.     (gimp-selection-shrink img 2)
  68.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  69.  
  70.     (gimp-selection-none img)
  71.  
  72.     ; Bumpmap
  73.  
  74.     (plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
  75.  
  76.     ; Clean up
  77.  
  78.     (gimp-palette-set-background '(0 0 0))
  79.     (gimp-selection-layer-alpha textl)
  80.     (gimp-selection-invert img)
  81.     (gimp-edit-clear background)
  82.     (gimp-selection-none img)
  83.  
  84.     (gimp-image-set-active-layer img background)
  85.     (gimp-image-remove-layer img bumpmap)
  86.     (gimp-image-remove-layer img textl)
  87.  
  88.     (if (= transparent FALSE)
  89.     (gimp-image-flatten img))
  90.  
  91.     (gimp-palette-set-background old-bg-color)
  92.     (gimp-image-undo-enable img)
  93.     (gimp-display-new img)))
  94.  
  95.  
  96. (script-fu-register "script-fu-beveled-pattern-heading"
  97.             _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern/H_eading..."
  98.             "Beveled pattern heading"
  99.             "Federico Mena Quintero"
  100.             "Federico Mena Quintero"
  101.             "July 1997"
  102.             ""
  103.             SF-STRING     _"Text"               "Hello world!"
  104.             SF-ADJUSTMENT _"Font Size (pixels)" '(72 2 200 1 1 0 1)
  105.             SF-FONT       _"Font" "Sans"
  106.             SF-PATTERN    _"Pattern"            "Wood"
  107.             SF-TOGGLE     _"Transparent Background" FALSE)
  108.